/*
 * COPYRIGHT:	2010 Christopher Smith, licenced under the GNU GPL v2; see COPYING in the top level directory
 * PROJECT:		sdedit
 * FILE:		editpopup.cpp
 * PURPOSE:		popup version of standard edit control
 *				
 */

namespace EditPopup
{

class WindowObject : public PopupBase
{
	virtual void Init() override
	{
		SetFocus(Wnd);
		PopupBase::Init();
	}

public:
	WindowObject(PWSTR InitialText, HWND Parent, DWORD ExtraStyle, HFONT Font, DIALOG_CALLBACK_PROC CallbackProc, PVOID Context, int x, int y, int Width, int Height) :
		PopupBase(CallbackProc, Context)
	{
		Create(0, L"EDIT", InitialText, WS_VISIBLE | ES_AUTOHSCROLL | ExtraStyle, x, y, Width, Height, Parent, NULL, NULL);
		
		SendMessage(Wnd, WM_SETFONT, (WPARAM)Font, NULL);
		
		size_t pos = wcslen(InitialText);
		SendMessage(Wnd, EM_SETSEL, pos, pos);
	}
};

} //namespace EditPopup